package wowmobileclient;

public class Action {

    public static final int STOP = 0;
    public static final int UP = 1;
    public static final int DOWN = 2;
    public static final int LEFT = 3;
    public static final int RIGHT = 4;
    private int move;

    public Action() {
        move = Action.STOP;
    }

    public Action(int move) {
        
            this.move = move;
        
    }

    public void setMove(int move) {
        
            this.move = move;
        
    }

    public int getMove() {
        return move;
    }

    public String toString() {
        String tmp = "" + move;
        return tmp;
    }

    public static Action fromString(String s) {
        int move;
        if (s.startsWith("0")) {
            move = 0;
        } else if (s.startsWith("1")) {
            move = 1;
        } else if (s.startsWith("2")) {
            move = 2;
        } else if (s.startsWith("3")) {
            move = 3;
        } else if (s.startsWith("4")) {
            move = 4;
        } else {
            return new Action();
        }

        return new Action(move);
    }
}
